/**
 * Credit card class, extends the abstract
 * parrent Card.
 * @author Kristopher Gooding/Kyle Scharnhorst
 * @version 4/25/2014
 */
public class CreditCard extends Card {
	
	/**
	 * constructor for an account.
	 * @param the_name
	 * @param the_street
	 * @param the_town
	 * @param the_zip_code
	 * @param the_country
	 */
	public CreditCard(final String the_name, final String the_street,
			final String the_town, final String the_zip_code,
			final String the_country) {
		super(the_name, the_street, the_town, the_zip_code, the_country);
		my_limit = 2500; // standard limit
		my_balance = 0;
	}

	/**
	 * consructor for an account with a limit.
	 * @param the_name
	 * @param the_street
	 * @param the_town
	 * @param the_zip_code
	 * @param the_country
	 * @param the_limit
	 */
	public CreditCard(final String the_name, final String the_street,
			final String the_town, final String the_zip_code,
			final String the_country, final double the_limit) {
		super(the_name, the_street, the_town, the_zip_code, the_country,
				the_limit);
		my_limit = the_limit;
		my_balance = 0;
	}

	/**
	 * method used to pay to the balance of the card.
	 * @param the_amount
	 * @return boolean representation for the success of the 
	 * transaction.
	 */
	public boolean pay(final double the_amount) {
		if ((my_balance - the_amount) < -my_limit) {
			my_balance -= the_amount;
			return true;
		} else {
			return false;
		}
	}

	/**
	 * @return my_limit
	 */
	public double getLimit() {
		return my_limit;
	}

	/**
	 * @return my_balance
	 */
	public double getBalance() {
		return my_balance;
	}

}
